﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Projektkylsim
{
    class Nod
    {
        public double Tryck
        {
            get;

            set;

        }
        public int X { get; set; }
        public int Y { get; set; }
        
        
        private bool reglerbar=true;
        private string namn;
        private Graphics canvas;
        private double summaflode = 0.0;
        
        private double admittans;
        private double ventiloppning;
        
       


        public Nod()
        {
            
        }

        public Nod(int x, int y, bool reglerbar, string namn, double tryck)
        {
            this.X = x;
            this.Y = y;
            this.reglerbar = reglerbar;
            this.namn = namn;
            this.Tryck = tryck;
        }



        public void add_summaflode(double flode)
        {
            summaflode = flode;
        }


        public void dynamik()
        {
            if (reglerbar)
            {
                if (summaflode > 0)
                    Tryck += 0.1;
                else if (summaflode < 0)
                    Tryck -= 0.1;
                summaflode = 0;
            }
            
        }

        

        public void rita(Graphics canvas)
        {
            Pen pen = new Pen(Color.BlueViolet);
            canvas.DrawEllipse(pen, X, Y, 15, 15);
            Brush brush = new SolidBrush(Color.Black);
            Font font = new Font("Courier", 12);
            canvas.DrawString(namn, font, brush, X, Y-20);
            canvas.DrawString("Tryck:" + string.Format("{0:F1}", Tryck), font, brush, 30, Y+10);
            canvas.DrawString("Tryck:" + string.Format("{0:F1}", Tryck), font, brush, 300, Y+10);
            canvas.DrawString("Tryck:" + string.Format("{0:F1}", Tryck), font, brush, 525, Y+10);

        }
        

    }
}
